<include file="public@header">
<link type="text/css" rel="stylesheet" href="__STATIC__/layui/css/layui.css">
<body>
    <div class="bgbg headhead">
        <h3 class="mytitle" style="margin-bottom: 0.2rem;"></h3>
        <div class="yjhead">
            <p class="yjheadp1">{:lang('Cumulative commission equivalent')}(USDT)</p>
            <div class="yjheadp2"><p>{:floatval($total)}</p><p>****</p><img src="__STATIC__/hybit/images/heye.png" alt="" onclick="islook(this)" data-type="look"><img src="__STATIC__/hybit/images/heye2.png" alt="" onclick="islook(this)" data-type="nolook"></div>
            <p class="yjheadp1">≈{:round(floatval($total)*get_usdt(),2)}CNY</p>
        </div>
        <div style="padding: 0.2rem 0.4rem;display: flex;">
            <input type="text" placeholder="{:lang('Please enter the account number')}" name="keyword" value="{:input('keyword')}" style="width: 5.7rem;height: 0.6rem;padding-left: 0.1rem;">
            <button id="search" style="width: 1rem;margin-left: auto;height: 0.6rem;border: 0;background: #edbe3a;color: #333;font-size: 0.28rem;">{:lang('Search')}</button>
        </div>
        <div class="zcdiv zcdiv1" id="LAY_demo1">
            <!-- <div class="zcbzshow">
                <h3>{:lang('From')}****{:lang('Commission')}</h3>
                <div class="zcbzshow1">
                    <div><h3>{:lang('Amount')}</h3><p>0 USDT</p></div>
                    <div><h3></h3><p></p></div>
                    <div><h3>{:lang('Convert')}(CNY)</h3><p>≈0</p></div>
                </div>
            </div> -->
        </div>
    </div>
    
    <script src="__STATIC__/hybit/js/jquery.min.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script>
        function islook(obj){
            let $this = $(obj);
            let type = $this.attr('data-type');
            if(type == 'look'){
                $this.parent().children('p').hide();
                $this.parent().children('p:eq(1)').show();
                $this.hide();
                $this.siblings('img').show();
            }else{
                $this.parent().children('p').hide();
                $this.parent().children('p:eq(0)').show();
                $this.hide();
                $this.siblings('img').show();
            }
        }

        $('#search').click(function(){
            var keyword = $('input[name=keyword]').val();
            window.location.href="{:url('user/share/fenyong')}?keyword="+keyword;
        });

        layui.use('flow', function(){
            var flow = layui.flow;
            var ustd_price = '{:get_usdt()}';

            flow.load({
                elem: '#LAY_demo1',
                mb: 200,
                done: function(page, next){
                    setTimeout(function(){
                        var lis = [];
                        var htm = '';
                        var keyword = '{:input("keyword")}';
                        $.ajax({
                            type:'get',
                            url:'{:url("user/share/fenyong")}',
                            data: {keyword:keyword},
                            success:function(data){
                                console.log(data);
                                var json = eval(data.data.data);
                                var total = eval(data.data.last_page);
                                for(var key in json){
                                    htm += '<div class="zcbzshow">';
                                    if(json[key]['mobile'] != ''){
                                        htm += '<h3>{:lang("Form")} '+json[key]['mobile']+' {:lang("Commission")}</h3>';
                                    }else{
                                        htm += '<h3>{:lang("Form")} '+json[key]['user_email']+' {:lang("Commission")}</h3>';
                                    }
                                    htm += '<div class="zcbzshow1">';
                                    htm += '<div><h3>{:lang("Amount")} </h3><p>'+parseFloat(json[key]['change']*1)+' USDT</p></div>';
                                    htm += '<div><h3></h3><p></p></div>';
                                    htm += '<div><h3>{:lang("Time")}</h3><p style="width:130px;">'+json[key]['create_time']+'</p></div>';
                                    htm += '</div>';
                                    htm += '</div>';
                                }
                                lis.push(htm);
                                next(lis.join(''), page < total); //假设总页数为 10
                            }
                        });
                    }, 500);
                }
            });
        });
    </script>
</body>
</html>